package com.transaction.demo.order.controller;

public class Test {
    public static void main(String[] args) {

        int i = 10;
        while (i > 0) {
            StringBuffer stringBuffer = new StringBuffer();
            TranContext context = new TranContext(new TranA());
            int str1 = context.executeTran(i);
            if (str1 == 1 || str1 == 2) {
                break;
            }
            stringBuffer.append("A");

            TranContext context2 = new TranContext(new TranB());
            int str2 = context2.executeTran(str1);
            if (str1 == 1 || str1 == 2) {
                break;
            }
            stringBuffer.append("B");


            TranContext context3 = new TranContext(new TranC());
            int str3 = context3.executeTran(str2);
            if (str3 == 1 || str3 == 2) {
                break;
            }
            stringBuffer.append("C");
            System.out.println("转换后" + stringBuffer);

        }

    }

}




